package com.example.vote.controller;


import com.example.vote.service.BizException;
import com.example.vote.service.ITpRecordService;
import com.yc.vcode.bean.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.SessionAttribute;

import javax.annotation.Resource;
import java.util.Map;

/**
 * <p>
 * 投票系统-投票记录表-6 前端控制器
 * </p>
 *
 * @author 廖老师
 * @since 2023-12-04
 */
@Controller
@RequestMapping("/vote/tpRecord")
public class TpRecordController {

    @Resource
    ITpRecordService recordService;

    @PostMapping("commit")
    @ResponseBody
    public Result commit(int vid, int[] iids,
                         @SessionAttribute(required = false) Map<String,Object> loginedUser)
            throws BizException {
        recordService.commit(vid, iids, loginedUser);
        return new Result(1, "提交成功!", null);
    }

}

